
#ifndef __USRAPP_H_INCLUDED__
#define __USRAPP_H_INCLUDED__

#include "vsfvm.h"
#include "lexer/dart/vsfvm_lexer_dart.h"
#include "vsfvm_compiler.h"
#include "std/vsfvm_ext_std.h"
#include "vsf/vsfvm_ext_vsf.h"

struct usrapp_t
{
	struct
	{
		struct vsf_usart_stream_t uart_stream;
		struct vsf_fifostream_t stream_tx;
		struct vsf_fifostream_t stream_rx;
		uint8_t txbuff[16 * 1024];
		uint8_t rxbuff[16 * 1024];
	} debug;

	struct
	{
		union
		{
			struct
			{
				struct vsfvmc_t vmc;
				struct vsfvmc_lexer_list_t dart;
			} vmc;
			struct
			{
				struct vsfvm_t vm;
				struct vsfvm_script_t script;
			} vm;
		};

		uint32_t token[4 * 1024];
		uint32_t token_num;
	} vsfvm;
};

extern struct usrapp_t usrapp;

void usrapp_initial_init(struct usrapp_t *app);
bool usrapp_cansleep(struct usrapp_t *app);
void usrapp_srt_init(struct usrapp_t *app);
void usrapp_srt_poll(struct usrapp_t *app);
void usrapp_nrt_init(struct usrapp_t *app);
void usrapp_nrt_poll(struct usrapp_t *app);

#endif		// __USRAPP_H_INCLUDED__
